<template>
  <div class="flex-c pl-10px">
    <el-tooltip
      effect="dark"
      placement="top-start"
    >
      <el-icon :size="20" color="var(--el-color-warning)"><InfoFilled /></el-icon>
      <template #content>
        <template v-if="type === 'goods'">
          <div>抓取更新频率（分钟）</div>
          <div>ebay：{{ formatTime(config.ebayGoods) }}</div>
          <div>amazon：{{ formatTime(config.amazonGoods) }}</div>
          <div>速卖通：{{ formatTime(config['a&mGoods']) }}</div>
        </template>
        <template v-else-if="type === 'cate'">
          <div>抓取更新频率（分钟）</div>
          <div>ebay：{{ formatTime(config.ebayCate) }}</div>
          <div>速卖通：{{ formatTime(config['a&mCate']) }}</div>
        </template>
        <template v-else-if="type === 'shop'">
          <div>抓取更新频率（分钟）</div>
          <div>ebay：{{ formatTime(config.ebayShop) }}</div>
          <div>amazon：{{ formatTime(config.amazonShop) }}</div>
          <div>速卖通：{{ formatTime(config['a&mShop']) }}</div>
        </template>
        <template v-else-if="type === 'keyword'">
          <div>抓取更新频率（分钟）</div>
          <div>ebay：{{ formatTime(config.ebayKeyword) }}</div>
          <div>amazon：{{ formatTime(config.amazonKeyword) }}</div>
          <div>速卖通：{{ formatTime(config['a&mKeyword']) }}</div>
        </template>
        <template v-else-if="type === 'title'">
          <div>抓取更新频率：{{ formatTime(config.goodsTitleRepetition) }}分钟</div>
        </template>
        <template v-else-if="type === 'tort'">
          <div>抓取更新频率：{{ formatTime(config.goodsTort) }}分钟</div>
        </template>
      </template>
    </el-tooltip>
  </div>
</template>

<script setup>
import { InfoFilled } from '@element-plus/icons-vue'
import { storeToRefs } from 'pinia'
import { useUserStore } from '@/store/modules/user'

defineProps({
  type: String,
})

const { config } = storeToRefs(useUserStore())

function formatTime(value) {
  return Math.floor(value * 6000) / 100
}
</script>

<style lang="scss" scoped>

</style>
